package com.qf.service.impl;

import com.qf.dao.BookDao;
import com.qf.dao.impl.BookDaoImpl;
import com.qf.entity.Book;
import com.qf.service.BookService;
import com.qf.util.DruidUtil;
import com.qf.util.Page;

import java.util.List;

/*
杨威
2021/9/19
18:38
*/
public class BookServiceImpl implements BookService {
    BookDao bookDao=new BookDaoImpl();
    @Override
    public List<Book> showAllBook() {
        List<Book> books = bookDao.selectAll();
        DruidUtil.close();
        return books;
    }

    @Override
    public List<Book> showAllBookByPage(Page page) {
        List<Book> books = bookDao.selectAllByPage(page);
        Long count = bookDao.selectCount();
        page.setTotalCount(count);
        return books;
    }
}
